<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <title>满屏漂字代码</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            width: 100vw;
            height: 100vh;
            overflow: hidden;
            background-image: url('static/images/1.jpg'); /* 替换为你的图片链接 */
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            background-attachment: fixed;
            position: relative;
            font-family: "Microsoft YaHei", Arial, sans-serif;
        }
        
        .win-popup {
            position: absolute;
            width: 220px;
            padding: 18px 16px;
            border-radius: 4px;
            border: 1px solid rgba(255,255,255,0.5);
            box-shadow: 0 3px 10px rgba(0,0,0,0.7);
            background-color: #fff;
            color: #000;
            font-size: 14px;
            line-height: 1.6;
            opacity: 0;
            transform: scale(0.8);
            pointer-events: none;
            z-index: 100;
            text-align: center;
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 80px;
        }

        .music-control {
            position: fixed;
            bottom: 20px;
            right: 20px;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background-color: rgba(255,255,255,0.3);
            color: white;
            border: none;
            cursor: pointer;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 18px;
            z-index: 200;
            backdrop-filter: blur(5px);
        }
        
        .div_btn a{color:#fff;text-decoration:none;}
        .div_btn {
            position: fixed; /* 保持固定定位，确保随屏幕滚动不偏移 */
            cursor: pointer;
            width: 42px;
            height: 42px;
            border: 2px solid #fff;
            border-radius: 50%;
            font-size: 1em;
            line-height: 40px;
            text-align: center;
            z-index: 999;
             bottom: 110px; /* 距离底部20px */
            right: 20px; /* 距离右侧80px（避开音乐按钮的40px宽度+20px间距） */
        }

        /* 关键：为按钮容器添加右下角定位样式 */
       
    </style>
</head>
<body>
    <!-- 背景音乐 -->
    <audio 
        id="myAudio" 
        src="https://sf5-hl-ali-cdn-tos.douyinstatic.com/obj/ies-music/7559239046338186026.mp3" 
        loop
    >
    </audio>

    <!-- 音乐控制按钮 -->
    <button class="music-control" id="musicBtn">▶</button>
    
    <!-- 调整后的按钮区域：已通过CSS定位到右下角 -->
    <div id="an" style="display: block;">
        <div class="div_btn" id="btn-make" style="animation: 1s ease 0s infinite normal both running jello;">
            <a href="http://accct.top/565/4.html"><span>分享</span></a>
        </div>
        <div class="div_btn" id="div_support" style=" bottom: 65px; ">
            <a href="http://accct.top/565/5.html"><span>制作</span></a>
        </div>
    </div>
    
    <!-- 页面加载后，监听用户第一次点击，触发播放 -->
    <script>
        document.addEventListener('click', function playAudio() {
            const audio = document.getElementById('myAudio');
            audio.play();
            document.removeEventListener('click', playAudio);
        });
    </script>
    <script>
        // 【自定义文案区】
        const popupTexts = [
           "期待下一次见面",
            "金榜题名",
            "今天过的开心嘛？",
            "保持好心情",
            "晚上早点休息，养足精神",
            "别忘记给家人打个电话",
            "天冷了，多穿衣服",
            "多喝水哦~",
            "别熬夜",
             "梦想成真",
            "每天元气满满",
            "多吃水果？",
            "早睡早起",
            "记得想我哟"
        ];
        
        // 【核心参数】
        let isPopping = true;
        let popupInterval;
        const popupSpeed = 100;
        const stayTime = 7000;
        let isMusicPlaying = false;
        
        // 补充jello动画（原代码缺失，导致"分享"按钮动画无效）
        const style = document.createElement('style');
        style.textContent = `
            @keyframes jello {
                0%, 100% { transform: scale(1); }
                30% { transform: scale(1.25, 0.75); }
                40% { transform: scale(0.75, 1.25); }
                50% { transform: scale(1.15, 0.85); }
                65% { transform: scale(0.95, 1.05); }
                75% { transform: scale(1.05, 0.95); }
            }
        `;
        document.head.appendChild(style);
        
        document.addEventListener('DOMContentLoaded', () => {
            if (popupTexts.length === 0) {
                alert("请在popupTexts数组中添加自定义文案！");
                return;
            }
            popupInterval = setInterval(createWinPopup, popupSpeed);
            initBGM();
        });
        
        // 背景音乐控制
        function initBGM() {
            const bgm = document.getElementById('myAudio');
            const musicBtn = document.getElementById('musicBtn');
            
            musicBtn.addEventListener('click', () => {
                if (isMusicPlaying) {
                    bgm.pause();
                    musicBtn.innerText = "▶";
                } else {
                    bgm.play().catch(err => {
                        alert("请点击页面后再尝试播放音乐（浏览器限制）");
                    });
                    musicBtn.innerText = "⏸";
                }
                isMusicPlaying = !isMusicPlaying;
            });
        }
        
        // 弹窗创建
        function createWinPopup() {
            if (!isPopping) return;
            
            const popupEl = document.createElement('div');
            popupEl.className = 'win-popup';
            
            const randomIndex = Math.floor(Math.random() * popupTexts.length);
            const randomText = popupTexts[randomIndex];
            popupEl.innerText = randomText || "默认提示";
            
            const [bgColor, textColor] = getRandomContrastColors();
            popupEl.style.backgroundColor = bgColor;
            popupEl.style.color = textColor;
            
            const winWidth = window.innerWidth;
            const winHeight = window.innerHeight;
            const popupWidth = popupEl.offsetWidth;
            const popupHeight = popupEl.offsetHeight;
            const maxLeft = winWidth - popupWidth - 20;
            const maxTop = winHeight - popupHeight - 20;
            const randomLeft = Math.max(10, Math.floor(Math.random() * maxLeft));
            const randomTop = Math.max(10, Math.floor(Math.random() * maxTop));
            popupEl.style.left = `${randomLeft}px`;
            popupEl.style.top = `${randomTop}px`;
            
            document.body.appendChild(popupEl);
            animatePopup(popupEl);
        }
        
        // 弹窗动画
        function animatePopup(el) {
            setTimeout(() => {
                el.style.transition = "opacity 0.3s ease, transform 0.3s ease";
                el.style.opacity = "1";
                el.style.transform = "scale(1)";
            }, 20);
            
            setTimeout(() => {
                el.style.opacity = "0";
                el.style.transform = "scale(0.8)";
                setTimeout(() => {
                    if (document.body.contains(el)) {
                        el.remove();
                    }
                }, 500);
            }, stayTime);
        }
        
        // 随机对比色
        function getRandomContrastColors() {
            const lightBgs = [
                "#ffd6d6", "#d6ffd6", "#d6d6ff", "#fff2d6", 
                "#d6f7ff", "#d6fff2", "#ffd6f2", "#f2d6ff"
            ];
            const darkTexts = [
                "#d32f2f", "#2e7d32", "#1976d2", "#f57c00", 
                "#7b1fa2", "#0288d1", "#388e3c", "#8e24aa"
            ];
            
            const darkBgs = [
                "#d32f2f", "#2e7d32", "#1976d2", "#f57c00", 
                "#7b1fa2", "#0288d1", "#388e3c", "#8e24aa"
            ];
            const lightTexts = [
                "#ffd6d6", "#d6ffd6", "#d6d6ff", "#fff2d6", 
                "#d6f7ff", "#d6fff2", "#ffd6f2", "#f2d6ff"
            ];
            
            if (Math.random() > 0.5) {
                const idx = Math.floor(Math.random() * lightBgs.length);
                return [lightBgs[idx], darkTexts[idx]];
            } else {
                const idx = Math.floor(Math.random() * darkBgs.length);
                return [darkBgs[idx], lightTexts[idx]];
            }
        }
        
        window.addEventListener('resize', () => {
            const allPopups = document.querySelectorAll('.win-popup');
            allPopups.forEach(el => el.remove());
        });
    </script>
</body>
</html>